<?php

/**
 * Valor filter form base class.
 *
 * @package    SistemaWebUnlSenescyt
 * @subpackage filter
 * @author     JFernando
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseValorFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id_dg' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('descripciongeneral'), 'add_empty' => true)),
      'id_ac' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('actividad'), 'add_empty' => true)),
      'id_fo' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('fondo'), 'add_empty' => true)),
      'mes'   => new sfWidgetFormFilterInput(),
      'anio'  => new sfWidgetFormFilterInput(),
      'val'   => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'id_dg' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('descripciongeneral'), 'column' => 'id_dg')),
      'id_ac' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('actividad'), 'column' => 'id_ac')),
      'id_fo' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('fondo'), 'column' => 'id_fo')),
      'mes'   => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'anio'  => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'val'   => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('valor_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Valor';
  }

  public function getFields()
  {
    return array(
      'id_va' => 'Number',
      'id_dg' => 'ForeignKey',
      'id_ac' => 'ForeignKey',
      'id_fo' => 'ForeignKey',
      'mes'   => 'Number',
      'anio'  => 'Number',
      'val'   => 'Text',
    );
  }
}
